package com.bailian.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bailian.common.annotation.Log;
import com.bailian.common.core.controller.BaseController;
import com.bailian.common.core.domain.AjaxResult;
import com.bailian.common.enums.BusinessType;
import com.bailian.system.domain.BlParkTags;
import com.bailian.system.service.IBlParkTagsService;
import com.bailian.common.utils.poi.ExcelUtil;
import com.bailian.common.core.page.TableDataInfo;

/**
 * 园区仓库标签Controller
 * 
 * @author bailian
 * @date 2025-08-04
 */
@RestController
@RequestMapping("/system/park_tags")
public class BlParkTagsController extends BaseController
{
    @Autowired
    private IBlParkTagsService blParkTagsService;

    /**
     * 查询园区仓库标签列表
     */
    @PreAuthorize("@ss.hasPermi('system:park_tags:list')")
    @GetMapping("/list")
    public TableDataInfo list(BlParkTags blParkTags)
    {
        startPage();
        List<BlParkTags> list = blParkTagsService.selectBlParkTagsList(blParkTags);
        return getDataTable(list);
    }

    /**
     * 导出园区仓库标签列表
     */
    @PreAuthorize("@ss.hasPermi('system:park_tags:export')")
    @Log(title = "园区仓库标签", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BlParkTags blParkTags)
    {
        List<BlParkTags> list = blParkTagsService.selectBlParkTagsList(blParkTags);
        ExcelUtil<BlParkTags> util = new ExcelUtil<BlParkTags>(BlParkTags.class);
        util.exportExcel(response, list, "园区仓库标签数据");
    }

    /**
     * 获取园区仓库标签详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:park_tags:query')")
    @GetMapping(value = "/{tagId}")
    public AjaxResult getInfo(@PathVariable("tagId") Long tagId)
    {
        return success(blParkTagsService.selectBlParkTagsByTagId(tagId));
    }

    /**
     * 新增园区仓库标签
     */
    @PreAuthorize("@ss.hasPermi('system:park_tags:add')")
    @Log(title = "园区仓库标签", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BlParkTags blParkTags)
    {
        return toAjax(blParkTagsService.insertBlParkTags(blParkTags));
    }

    /**
     * 修改园区仓库标签
     */
    @PreAuthorize("@ss.hasPermi('system:park_tags:edit')")
    @Log(title = "园区仓库标签", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BlParkTags blParkTags)
    {
        return toAjax(blParkTagsService.updateBlParkTags(blParkTags));
    }

    /**
     * 删除园区仓库标签
     */
    @PreAuthorize("@ss.hasPermi('system:park_tags:remove')")
    @Log(title = "园区仓库标签", businessType = BusinessType.DELETE)
	@DeleteMapping("/{tagIds}")
    public AjaxResult remove(@PathVariable Long[] tagIds)
    {
        return toAjax(blParkTagsService.deleteBlParkTagsByTagIds(tagIds));
    }
}
